﻿Imports MySql.Data.MySqlClient

Module Module1
    Public connInfo As String
    Function updateRecord(ByVal query As String) As Integer
        Try
            Dim connection As New MySqlConnection(connInfo)
            Dim cmd As New MySqlCommand(query, connection)
            connection.Open()
            cmd.ExecuteNonQuery()
            connection.Close()
            Return 1
        Catch ex As Exception
            Return 0
        End Try
    End Function
    Function viewQuery(ByVal query As String) As Integer
        Try
            Dim connection As New MySqlConnection(connInfo)
            Dim cmd As New MySqlCommand(query, connection)

            connection.Open()

            Dim reader As MySqlDataReader
            reader = cmd.ExecuteReader()
            Dim int As Integer = 0
            While reader.Read()
                int = int + 1
            End While
            reader.Close()
            connection.Close()
            If int > 0 Then
                Return 1
            Else
                Return 0
            End If
        Catch ex As Exception
            Return 0
        End Try
    End Function
End Module
